package com.litelimit.autoconfigure.configure;

import com.litelimit.core.limit.LiteLimitProps;
import com.litelimit.core.service.aop.LiteLimitAspect;
import com.litelimit.core.strategy.LimitStrategyManager;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 切面类配置
 */
@Configuration
@RequiredArgsConstructor
public class AspectConfiguration {

    private final LiteLimitProps liteLimitProps;
    private final LimitStrategyManager limitStrategyManager;

    @Bean
    @ConditionalOnMissingBean(LiteLimitAspect.class)
    public LiteLimitAspect liteLimitAspect(){
        return new LiteLimitAspect(limitStrategyManager, liteLimitProps);
    }

}
